var Singleton = function (name) {
    this.name = name
}
Singleton.prototype.getName = function () {
    return this.name
}
Singleton.instance = null
Singleton.getInstance = function (name) {
    if (!this.instance) {
        this.instance = new Singleton(name)
    }
    return this.instance
}

var a = Singleton.getInstance("bigyoung")
var b = Singleton.getInstance("bigyoung2")
console.log(a === b);
console.log(a.getName(), b.getName());
